package com.gwz.sys.service.impl;

import com.gwz.sys.entity.Room;
import com.gwz.sys.mapper.RoomMapper;
import com.gwz.sys.service.IRoomService;
import com.gwz.sys.utils.DataGridView;
import com.gwz.sys.vo.RoomVo;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author gwz
 * @since 2019-01-04
 */
@Service
@Transactional
public class RoomServiceImpl extends ServiceImpl<RoomMapper, Room> implements IRoomService {

	@Autowired
	private RoomMapper roomMapper;
	
	@Override
	public DataGridView queryAllRoom(RoomVo roomVo) {
		Page<Object> page = PageHelper.startPage(roomVo.getPage(), roomVo.getLimit());
		List<Room> list = roomMapper.queryAllRoom(roomVo);
		return new DataGridView(page.getTotal(),list);
	}

}
